<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--
    编写函数实现交换两个变量的值，并将交换的结果返回
-->

<script>

    var num1 = 10
    var num2 = 20

    num1 = [num2, num2 = num1][0] // [20,10]


    // function changeNumber(a, b) {
    //     return [a, b]
    // }
    //
    // var res = changeNumber(num1, num2);
    // num1 = res[1]
    // num2 = res[0]


    console.log("num1=" + num1); //  20
    console.log("num2=" + num2); //  10

</script>

</body>
</html>